package so.sao.shop.supplier.dao;

import org.apache.ibatis.annotations.Param;
import so.sao.shop.supplier.domain.CheckingAccountAlipay;
import so.sao.shop.supplier.domain.CheckingAccountPayment;
import so.sao.shop.supplier.pojo.vo.CheckingAccountAlipayVo;

import java.util.List;


/**
 * <p>Version: supplier V1.2.0 </p>
 * <p>Title: CheckingAccountPaymentDao</p>
 * <p>Description: 透云订单支付回掉数据，用于对账</p>
 *
 * @author: fangzhou
 * @Date: Created in 2017/11/22 11:10
 */
public interface CheckingAccountPaymentDao {

    /**
     * 筛选出未银货两讫的支付回调信息数据写入对账的支付信息表
     * @param checkerId
     * @param recordId
     */
    void insertAccountPayment(@Param("checkerId")Long checkerId, @Param("recordId")Long recordId);

    /**
     * 与阿里数据中的支付信息进行对账
     * @param pay
     * @return
     */
    List<CheckingAccountPayment> checkPaidTypeByAlipay(CheckingAccountAlipay pay);

    /**
     * 根据商户订单号，支付流水号，记录Id统计支付信息条数及金额
     * @param pay
     * @return
     */
    CheckingAccountAlipayVo countPaidType(CheckingAccountAlipay pay);

    /**
     * 根据商户订单号，支付流水号，记录Id统计退款信息条数及金额
     * @param payId
     * @param paymentNum
     * @param recordId
     * @return
     */
    CheckingAccountAlipayVo countRefundType(@Param("payId")String payId, @Param("paymentNum")String paymentNum, @Param("recordId")Long recordId);

    /**
     * 根据商户订单号，支付流水号，记录Id查询支付和退款记录
     * @param pay
     * @return
     */
    List<CheckingAccountPayment> findPaidAndRefund(CheckingAccountAlipay pay);

    /**
     * 根据商户订单号，支付流水号，记录Id查询退款记录
     * @param payId
     * @param paymentNum
     * @param recordId
     * @return
     */
    List<CheckingAccountPayment> findRefund(@Param("payId")String payId, @Param("paymentNum")String paymentNum, @Param("recordId")Long recordId);

    /**
     * 将阿里退款数据传入平台进行对账
     * @param list
     * @return
     */
    List<CheckingAccountPayment> checkRefundType(List<CheckingAccountAlipay> list);

    /**
     * 查出阿里无智购平台有的数据
     * @param recordId
     * @return
     */
    List<CheckingAccountPayment> findPaymentHave(@Param("recordId")Long recordId);
}